feat: use self-signed JWTs in Spanner MutableCredentials#13381
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates MutableCredentials to use JWT access with scope by calling .createWithUseJwtAccessWithScope(true) on the scoped credentials, and updates the corresponding unit tests to mock this behavior. The review feedback points out redundant casts to ServiceAccountCredentials in both the constructor and the updateCredentials method, suggesting their removal to improve code readability.
| delegate = | ||
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | ||
| .createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast to ServiceAccountCredentials is redundant because credentials is already of type ServiceAccountCredentials, and its createScoped method returns ServiceAccountCredentials via covariant return type. Removing the redundant cast and extra parentheses improves code readability.
| delegate = | |
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | |
| .createWithUseJwtAccessWithScope(true); | |
| delegate = credentials.createScoped(this.scopes).createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast is necessary - ServiceAccountCredentials.createScoped returns an instance of GoogleCredentials, not ServiceAccountCredentials
| delegate = | ||
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | ||
| .createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast to ServiceAccountCredentials is redundant here as well because credentials is of type ServiceAccountCredentials. Removing the redundant cast and extra parentheses simplifies the code.
| delegate = | |
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | |
| .createWithUseJwtAccessWithScope(true); | |
| delegate = credentials.createScoped(scopes).createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast is necessary - see other comment
c007f3c to
bba8c68
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates MutableCredentials to use JWT access with scopes by calling createWithUseJwtAccessWithScope(true) on the scoped credentials, and updates the corresponding unit tests to mock this behavior. The review feedback suggests removing redundant casts to ServiceAccountCredentials in both the constructor and the updateCredentials method to simplify the code and improve readability.
| delegate = | ||
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | ||
| .createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast to ServiceAccountCredentials is redundant because ServiceAccountCredentials.createScoped already returns ServiceAccountCredentials (via covariant return type). Removing the redundant cast and extra parentheses simplifies the code and improves readability.
| delegate = | |
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | |
| .createWithUseJwtAccessWithScope(true); | |
| delegate = credentials.createScoped(this.scopes).createWithUseJwtAccessWithScope(true); |
| delegate = | ||
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | ||
| .createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast to ServiceAccountCredentials is redundant here as well. Removing it simplifies the expression and improves readability.
| delegate = | |
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | |
| .createWithUseJwtAccessWithScope(true); | |
| delegate = credentials.createScoped(scopes).createWithUseJwtAccessWithScope(true); |
WIP